<template>

	<div>


		<el-row :gutter="10">
			<el-col :span="5">
				<el-input v-model="search.contentName" placeholder="请输入查找的名称"></el-input>
			</el-col>
			<el-col :span="19">
				<el-button type="primary" icon="el-icon-search" plain @click="searchData()">搜索</el-button>
				<!-- <el-button type="primary" icon="el-icon-circle-plus-outline" plain @click="add()">添加</el-button> -->
			</el-col>
		</el-row>
		
		<el-table :data="result.tableData" style="width: 100%" @selection-change="handleSelectionChange">
			
			<el-table-column label="序号" prop="contentId">

			</el-table-column>

			<el-table-column label="编号" prop="contentNumber">
			</el-table-column>

			<el-table-column label="名称" prop="contentName">
			</el-table-column>

			<el-table-column label="价格" prop="contentPrice">
			</el-table-column>
			
			<el-table-column label="描述" prop="contentDescribe">
			</el-table-column>

			<el-table-column label="增值" prop="contentAppreciation">
			</el-table-column>

			<el-table-column label="状态" prop="contentStatus">
			</el-table-column>

			<el-table-column label="备注" prop="contentRemarks">
			</el-table-column>
			
			<!-- <el-table-column label="操作" width="220px">
						 
				<template slot-scope="scope">
					<template >
					    <el-button type="warning"
					        size="mini"
							icon="el-icon-edit" 
							@click="edit(scope.row.contentId)">修改</el-button>
									  
								
					 	<el-button
					 	    size="mini"
					 	    type="danger"
							icon="el-icon-delete-solid" 
					 	    @click="del(scope.row.contentId)">删除</el-button>
					 
					 	 		 	 
					</template>
				</template>
			</el-table-column> -->


		</el-table>
			<el-dialog :title="title" :visible.sync="show" :close-on-click-modal="false" width="500px">
				<NursingContentEdit v-if="show" :show.sync="show" @getData="getData()" :editid="editid">
				</NursingContentEdit>
			</el-dialog>
		
		
			<el-pagination
		  style="margin-top:20px;"
		  background
		  layout="prev, pager, next"
		  :page-count="result.pages"
		  :current-page.sync="query.pageNo"
		  :page-size="query.pageSize"
		  @current-change="getData()">
		</el-pagination>
  

	</div>
</template>

<script>
	import NursingContentEdit from '@/views/nursing_content/edit'
	export default {
			name: 'NursingContent',
			components: {
				NursingContentEdit,
			},
			data() {
				return {
					showNum: 0,
					editid: null,
					search: {
						Name: ''
					},
					query: {
						Name: '',
						pageNo: 1,
						pageSize: 8
					},
					result: {
						tableData: [],
						pages: 0
					},
					show: false,
					selectedrow: [],
					title: ''
				}
			},
			created() {
				this.getData()
			},
			methods: {
				getData() {
					this.axios.get('/nursingContent/list', response => {
						this.result.tableData = response.obj.records
						this.result.pages = response.obj.pages
						console.log(this.result.tableData)
					}, this.query)
				},
				searchData() {
					this.query.contentName = this.search.contentName
					this.query.pageNo = 1
					this.getData()
				},
				
				// edit(contentId) {
				// 	this.title = '修改信息';
				// 	this.editid = contentId;
				// 	this.showNum++;
				// 	this.show = true;
				// },
				
	// 			add() {
	// 				this.title = '添加';
	// 				this.editid = null;
	// 				this.showNum++;
	// 				this.show = true;
	// 			},
	
	// 			del(contentId) {
	// 				this.axios.del('/nursingContent/del', response => {
	// 					this.getData()
	// 				}, {
	// 					contentId: contentId
	// 				})
	// 			},
				handleSelectionChange(val) {
					// val参数为所有选中行的数据
					this.selectedrow = val
				},
				batchdel() {
					if (this.selectedrow.length === 0) {
						this.$message('没有任何被选中的数据');
					} else {
						const ids = []
						for (let i = 0; i < this.selectedrow.length; i++) {
							ids.push(this.selectedrow[i].id)
						}
						this.axios.del('/ums-user/batchdel', response => {
							this.getData()
						}, {
							ids: ids
						})
					}
				},
	 }
	}
</script>
<style scoped>
	/* el-table el-table-column{
		text-align: center;
	} */
</style>